# Contributor: Magnus Sandin <magnus.sandin@gmail.com>
# Maintainer: Magnus Sandin <magnus.sandin@gmail.com>
pkgname=noip2
pkgver=2.1.9
pkgrel=0
pkgusers=noip
pkggroups=noip
pkgdesc="Dynamic DNS Update Client for noip.com"
url="https://www.noip.com"
arch="all"
license="GPL-2.0-or-later"
subpackages="$pkgname-doc $pkgname-openrc"
install="$pkgname.pre-install"
source="$pkgname-$pkgver.tar.gz::https://www.noip.com/client/linux/noip-duc-linux.tar.gz
	fix_config_path.patch
	noip2.confd
	noip2.initd
	"
builddir="$srcdir/noip-$pkgver-1"
options="!check" # No tests available

build() {
	make noip2
}

package() {
	# binary
	install -Dm755 noip2 -t "$pkgdir"/usr/bin/

	# config
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
	mkdir -p "$pkgdir"/etc/$pkgname
	chown $pkgusers:$pkggroups "$pkgdir"/etc/$pkgname
	chmod 700 "$pkgdir"/etc/$pkgname

	# docs
	mkdir -p "$pkgdir"/usr/share/doc/$pkgname
	cp COPYING "$pkgdir"/usr/share/doc/$pkgname/
	cp README* "$pkgdir"/usr/share/doc/$pkgname/
	cp L*.* "$pkgdir"/usr/share/doc/$pkgname/

	# open-rc
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
6c32397f31e6f4875a2429398c2627cbe52abba569830ddc1190fed3f4c6cb23e232e60b23d9fa97940f98a1c5c019a89812844f92a655c6ebf275b784015125  noip2-2.1.9.tar.gz
7c03dab93387aa786a2e487c22e23458d06b6cae2fc4dab20beee114cdd30a5ad5c8b7366d73fa85d34e11a65c11eaa118022cbd047cd79d8ffccb6f7fdc5396  fix_config_path.patch
c60b567d1cbaeb910917b004406aee102da4281949e8f75fabd9b8951e4ab019187390fc29655cb5a2e6161555b6bfaea7b72b587cd7be3a55f5bb81dbdc69ac  noip2.confd
38ba5c089d00fe4713bfb285b1047e0278d8fed948a0f71b30331a0f4ec90be854b475703cc65ed1a8955842167075735115f7dc2bb409c4bfa24c07b39e2649  noip2.initd
"
